package ooday04;

import java.util.concurrent.Callable;

public class Test {
    public static void main(String[] args) {

        Animal[] animals = new Animal[5];
        animals[0] = new Dog("黑8", 2, "黑色");
        animals[1] = new Chick("坤哥", 2, "黄色");
        animals[2] = new Fish("中华鲟", 2, "白色");
        animals[3] = new Chick("鲲鲲", 2, "黑色");
        animals[4] = new Chick("鸡哥", 2, "绿色");
        for (int c = 0; c < animals.length; c++) {
            System.out.println(animals[c].name);
            animals[c].eat();
            animals[c].Drink();
            if (animals[c]instanceof Dog){
                Dog dog=(Dog) animals[c];
                dog.lookehome();
                dog.swim();
            }
            if (animals[c]instanceof Chick){
                Chick chick=(Chick) animals[c];
                chick.layeggs();
                chick.eat();


                    }
            if (animals[c]instanceof Fish){
                Fish fish=(Fish) animals[c];
                fish.swim();
                fish.eat();
                }
            if (animals[c]instanceof Swim){
                Swim s=(Swim) animals[c];
                s.swim();
            }
            }







        }



/*
        Master master=new Master();
        Dog dog=new Dog("小黑",2,"绿色");
        Fish fish=new Fish("黑鱼",2,"黑色");
        Chick chick=new Chick("鲲鲲",2,"黄色");
        master.feed(dog);
        master.feed(fish);
        master.feed(chick);
    }

 */


    }

